import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import persistedstate from 'vuex-persistedstate'
import { importModulesFiles } from '@/common/index'
const modules = importModulesFiles(
  require.context('./modules/', true, /\.js$/),
  true
)
Vue.use(Vuex)

const store = new Vuex.Store({
  modules,
  getters,
  plugins: [
    persistedstate({
      paths: ['user.token', 'user.userInfo']
    })
  ]
})

export default store
